
from option import Option

SIGNALS={}

def connect(signal,callback,userdata=None):
	global SIGNALS
	if not signal in SIGNALS:
		SIGNALS[signal]=[]
	
	SIGNALS[signal].append((callback,userdata))

def emit(signal,data=None):
	global SIGNALS
	if not signal in SIGNALS:
		return

	for s in SIGNALS[signal]:
		s[0](signal,data,s[1])
		
